/**********************************************************************************************/
/* FBL_I_Unknown.cpp	                                                      				  */
/*                                                                       					  */
/* Copyright Paradigma, 1993-2006															  */
/* All Rights Reserved                                                   					  */
/**********************************************************************************************/

#include <VShared/FBL/publ/Headers/StdAfx.h> 

#include <VShared/FBL/publ/Headers/FBL.h>
#include <VShared/FBL/publ/Headers/FBL_Atomic.h>


/**********************************************************************************************/
FBL_Begin_Namespace
 

/**********************************************************************************************/
void* InterfaceTableQueryInterface( 
	const void* 			inThis, 
	const INTERFACE_ITEM* 	inTable, 
	InterfaceID		 		inIID )
{
	void* res = NULL;

	if( inIID == IID_I_Unknown )
	{
		// first entry should be offset of I_Unknown interface:
		res = (char*)inThis + inTable->offset;
	}
	else
	{
		while( inTable->iid )
		{
			if( inTable->iid == inIID )
			{
				res = (char*)inThis + inTable->offset;
				break;
			}
			
			++inTable;
		}
	}
	
	return res;
}

/**********************************************************************************************/
FBL_End_Namespace
